﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.PO;
using System.Web.Caching;
using System.IO;
using ht = System.Web.HttpRuntime;
namespace Com.CMS263.Caches
{
     public  class ArtCache:CacheUtil
    {
        
         public void AddArt(ArtBase ab) 
         {
             string savePath = System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["cachepath"]);
             if (!Directory.Exists(savePath))
             {
                 Directory.CreateDirectory(savePath);
             }
             string ArtDPFile = savePath+"art\\Art"+ab.id+".txt"; //System.Web.HttpContext.Current.Server.MapPath("/cacheFile/Art/Art"+ab.id+".txt");

              Add(ab, "Art" + ab.id, ArtDPFile);
         }

         public bool Exist(int id) 
         {
             return ht.Cache["Art" + id] == null;
            
         }
    }
}
